def getdata():
    file = open(r"C:\Users\小姜\Desktop\fitbit flex2.txt", "a", encoding="utf-8")
    for i in range(1,101):#获取10页
        if i%10==0:
            time.sleep(random.random()+1)
        url="https://www.amazon.com/Fitbit-Flex-Black-Version-Count/product-reviews/B01KH2PV4U/ref=cm_cr_arp_d_paging_btm_next_2?ie=UTF8&reviewerType=all_reviews&pageNumber="+str(i)
        html=geturl(url)
        soup=BeautifulSoup(html,"html.parser")
        for item in soup.find_all('div',class_="a-row a-spacing-small review-data"):
             item=str(item)
             comment=re.findall(findcomment,item)[0]
             file.write(comment)
             file.write("\n")
